<table>
<?php
include_once('../../manager/includes/config.inc.php');

$base = $base_path;
$dbhost = $database_host;
$dbuser = $database_user;
$dbpass = $database_password;
$dbname = $dbase;
$snippath = 'snippets';
$mngrpath = 'manager';

// Uninstaller

function uninstaller($f){
	foreach ($f as $fl){
		echo '<tr>';
		if (file_exists($fl)) {
			exec('rm ' + $fl);
			if (file_exists($fl)){
				echo '<td>';
				echo '...' . substr($fl, -55, 55);
				echo '</td>';
				echo '<td style="color: #FF0026;">';
				echo 'Not Deleted';
				echo '</td>';				
			} else {
				echo '<td>';
				echo '...' . substr($fl, -55, 55);
				echo '</td>';
				echo '<td style="color: #04FF00;">';
				echo 'OK';
				echo '</td>';
			}
		} else {
			echo '<td style="color: #FF0026;">';
			echo 'Not Found';
			echo '</td>'
		}
		echo '</tr>';
	}

	
	foreach ($f as $fl){
		if (file_exists($fl)) {
			exec('rm ' + $fl);
		}
	}
}

function dirremove($d){
	foreach ($d as $dr){
		echo '<tr>';
		if (file_exists($dr)) {
			exec('rm -r ' + $dr);
			if (file_exists($dr)){
				echo '<td>';
				echo '...' . substr($dr, -55, 55);
				echo '</td>';
				echo '<td style="color: #FF0026;">';
				echo 'Not Deleted';
				echo '</td>';				
			} else {
				echo '<td>';
				echo '...' . substr($dr, -55, 55);
				echo '</td>';
				echo '<td style="color: #04FF00;">';
				echo 'OK';
				echo '</td>';
			}
		} else {
			echo '<td style="color: #FF0026;">';
			echo 'Not Found';
			echo '</td>'
		}
		echo '</tr>';
	}
}

// Compile list of files installed
// Uninstall Shopping Cart Stuff
$files = array();
$files[] = $base . $snippath . "shoppingCart/md5.js";
$files[] = $base . $snippath . "shoppingCart/cartmanager.js";
$files[] = $base . $snippath . "shoppingCart/cartmanager.php";
$files[] = $base . $snippath . "shoppingCart/kiwee.class.php";
$files[] = $base . $snippath . "shoppingCart/db.class.php";
$files[] = $base . $snippath . "shoppingCart/admininterop.php";
$files[] = $base . $snippath . "shoppingCart/dbconfig.inc.php";
$files[] = $base . $snippath . "shoppingCart/checkout_buttons.gif";
$files[] = $base . $snippath . "shoppingCart/google_button.gif";
$files[] = $base . $snippath . "shoppingCart/paypal_button.gif";
uninstaller($files);
// Uninstall Modal Window Files
$files = array();
$files[] = $base . $mngrpath . "js/prototype.js";
$files[] = $base . $mngrpath . "js/modal_window/images/close.gif";
$files[] = $base . $mngrpath . "js/modal_window/images/overlay.png";
$files[] = $base . $mngrpath . "js/modal_window/javascripts/modal.js";
$files[] = $base . $mngrpath . "js/modal_window/javascripts/prototype.js";
$files[] = $base . $mngrpath . "js/modal_window/stylesheets/modal.css";
uninstaller($files);

// Uninstall Admin Pages
$files = array();
$files[] = $base . $mngrpath . "actions/ajax.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/drl.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/tax.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/lists.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/options.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/products.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/orders.php";
$files[] = $base . $mngrpath . "actions/ajaxprocs/customers.php";
$files[] = $base . $mngrpath . "actions/overview_kiwee.static.php";
$files[] = $base . $mngrpath . "actions/includes/Kiwee.gif";
$files[] = $base . "assets/images/Kiwee.gif";
$files[] = $base . $mngrpath . "actions/includes/kiwee.css";
$files[] = $base . $mngrpath . "actions/includes/Kiwee-small.gif";
$files[] = $base . $mngrpath . "actions/ecommerce_config.dynamic.php";
$files[] = $base . $mngrpath . "actions/product_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/list_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/tax_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/discount_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/options_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/order_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "actions/customer_maintenance.dynamic.php";
$files[] = $base . $mngrpath . "includes/lang/english.inc.php";
$files[] = $base . $mngrpath . "processors/save_kiwee_settings.processor.php";
uninstaller($files);

// Uninstall Admin Page Includes
$files = array();
$files[] = $base . $mngrpath . "actions/includes/dynform.js";
$files[] = $base . $mngrpath . "actions/includes/interface.js";
$files[] = $base . $mngrpath . "actions/includes/md5.js";
uninstaller($files);
  
// DROP DATABASE TABLES ADDED

// DELETE RECORDS IN TABLES WE ADDED

// REMOVE SITE TEMPLATES

// REMOVE SITE CONTENT PAGES

// REMOVE TEMPLATE VARIABLES

// REMOVE TEMPLATE VARIABLE TEMPLATES

// REMOVE TEMPLATE VARIABLE CONTENT VALUES

// REMOVE DIRS ADDED

$dirs = array();
$dirs[] = $base . $snippath . "shoppingCart";
$dirs[] = $base . $snippath . "shoppingCart/includes";
$dirs[] = $base . $mngrpath . "js";
$dirs[] = $base . $mngrpath . "actions/ajaxprocs";
$dirs[] = $base . $mngrpath . "actions/includes";
$dirs[] = $base . $mngrpath . "js/modal_window";
$dirs[] = $base . $mngrpath . "js/modal_window/images";
$dirs[] = $base . $mngrpath . "js/modal_window/javascripts";
$dirs[] = $base . $mngrpath . "js/modal_window/stylesheets";
$dirs[] = $base . "assets/templates/kiwee/scripts";
$dirs[] = $base . "assets/templates/kiwee/images";
$dirs[] = $base . "assets/templates/kiwee/css";
$dirs[] = $base . "assets/templates/kiwee";
dirremove($dirs);
// REINSTALL DEFAULT INDEX AND MENU
?>
</table>